using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace StandardRobotppTool.ViewModels
{
    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        // 声明为可为空的事件
        public event PropertyChangedEventHandler? PropertyChanged;

        protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
        {
            // 使用空条件运算符安全触发事件
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}